import request from '@/utils/request'

// 生成一次性密码
export function hxAddSingleKey(query) {
  return request({
    url: '/offlinePassword/passwordGeneration',
    method: 'get',
    params: query
  })
}
// // 生成一次性密码
// export function hxAddSingleKey(roomId) {
//   return request({
//     url: '/hx/hxAddSingleKey?roomId='+roomId,
//     method: 'get',
//   })
// }

// 远程开锁
export function hxOpenDoorLock(lockMac) {
  return request({
    url: '/lock/room/hxOpenDoorLock?lockMac='+ lockMac,
    method: 'get',
  })
}

// 取消远程开锁
export function hxcancelOpenLock() {
  return request({
    url: '/lock/room/cancelOpenLock',
    method: 'get',
  })
}
// // 远程开锁
// export function hxOpenDoorLock(roomId) {
//   return request({
//     url: '/lock/room/hxOpenDoorLock?roomId='+roomId,
//     method: 'get',
//   })
// }


// 获取门锁日志列表
export function apartmentLockLogList(query) {
  return request({
    url: '/lock/room/apartmentLockLogList',
    method: 'get',
    params: query
  })
}

//房间信息
export function hxRoom(query) {
  return request({
    url: '/lock/room/list1',
    method: 'get',
    params: query
  })
}

//添加房间离线密码
export function hxAddPassword(query) {
  return request({
    url: '/lock/room/hxAddPassword',
    method: 'get',
    params: query
  })
}

//修改用户有效期
export function hxTenantRenewRoom(query) {
  return request({
    url: '/lock/room/hxTenantRenewRoom',
    method: 'get',
    params: query
  })
}


//冻结用户
export function hxRoomFrozenTenant(data) {
  return request({
    url: '/lock/room/hxRoomFrozenTenant',
    method: 'get',
    params: data
  })
}

//解冻用户
export function defrostUser(data) {
  return request({
    url: '/lock/room/defrostUser',
    method: 'get',
    params: data
  })
}

// 查询设备周期性密码列表
export function listPeriodicPasswords(deviceMac, homeId, showExpired) {
  return request({
    url: '/lock/periodic/password/listByMacAndHomeId',
    method: 'get',
    params: { deviceMac, homeId, showExpired }
  })
}

// 更新周期性密码备注
export function updatePasswordRemarks(id, remarks) {
  return request({
    url: `/lock/periodic/password/updateRemarks/${id}`,
    method: 'put',
    params: { remarks }
  })
}

